import request from '@/utils/httpRequest'

// 上传
export const upload = data => request({
    url: '/bsnl-oss/upload',
    method: 'post',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    data
});
// 上传 会返回第一帧图片
export const uploadShot = data => request({
  url: '/bsnl-oss/uploadShot',
  method: 'post',
  headers: {
      'Content-Type': 'multipart/form-data'
  },
  data
});

// 获取分类树形结构信息
export const getCategoryTree = () => request({
    url: '/bsnl-product/category/tree',
    method: 'get'
});

// 获取全部的供应商、仓库信息
export const getMerchantWarehouse = () => request({
    url: '/merchant/info/ck/all',
    method: 'get'
});

// 获取全部的供应商信息
export const getMechantList = (params = {}) => request({
    // url: '/bsnl-product/goods/queryMerchant',
    url: '/erp-file/ghs/query',
    method: 'post',
    data: {
        pageIndex: 1,
        pageSize: 2000,
        isTy: 0,
        ...params
    }
});

// 获取全部的仓库信息
export const getWarehouseList = (data = {}) => request({
    url: '/erp-file/cangku/query',
    method: 'post',
    data: {
        pageIndex: 1,
        pageSize: 2000,
        ty: 0,
        ...data
    }
});

// 获取全部的标签信息
export const getTagList = (params = {}) => request({
    url: '/bsnl-product/tag/list',
    method: 'get',
    params: {
        isPage: 0,
        ...params
    }
});

// 获取全部的商品类别信息
export const getGoodsTypeList = (params = {}) => request({
    url: '/bsnl-product/goodsType/list',
    method: 'get',
    params: {
        isPage: 0,
        ...params
    }
});

// 通过商品类型Id获取规格列表
export const getAttrByTypeId = (params = {}) => request({
    url: `/bsnl-product/goodsType/attribute/${params.goodsTypeId}`,
    method: 'get',
    params: {
        isPage: 0,
        ...params
    }
});

// 获取资源列表
export const getUserAccessList = () => request({
    url: '/bsnl-authority/resource/tree',
    method: 'get'
});

// 获取角色列表
export const getRoleList = (params = {}) => request({
    url: '/bsnl-authority/role/list',
    method: 'get',
    params
});
